<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>个人信息页面</title>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <style media="screen">
        input {
            border: 0; // 去除未选中状态边框
            outline: none!important; // 去除选中状态边框
            background-color: rgba(0, 0, 0, 0); // 透明背景
        }

        body {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
        }

        .header-msg {
            height: 10%;
            display: flex;
            justify-content: left;
            align-items: center;
            background: #3fd5a5;
        }

        .title {
            width: 30%;
            height: auto;
            font-size: 1.5rem;
            margin: auto;
            color: #fff;
        }

        .contanier {
            height: 65%;
        }

        .log {
            height: 45%;
            background-image: url('../../../image/login-img.png');
            background-size: 30%;
            background-position: center;
            background-repeat: no-repeat;
        }

        .form {
            height: 35%;
            width: 90%;
            margin: 5% auto 20%;
            font-size: 1.5rem;
            color: #ccc;
        }

        .personalName,
        .personalphone {
            display: inline-block;
            width: 20%;
            height: 15%;
            text-align: center;
            justify-content: left;
        }

        #username,
        #userphone {
            width: 70%;
            border: 1px solid #ccc;
            font-size: 1.5rem;
            color: #ccc;
            display: inline-block;
            margin-bottom: 5%;
        }

        #logout_button {
            height: 15%;
            width: 80%;
            margin: 0 auto;
            background: #3fd5a5;
            border-radius: 2rem;
            font-size: 1.5rem;
            color: #fff;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .touch-down {
            opacity: .4;
        }
    </style>
</head>

<body>
    <section class="header-msg">
        <div class="title">个人信息</div>
    </section>
    <section class="contanier">
        <section class="log">
        </section>
        <ul class="form">
            <li><span class="personalName">姓名</span><input type="text" name="username" value="" id="username" readonly="readonly"></li>
            <li><span class="personalphone">电话</span><input type="tel" name="number" value="" id="userphone" readonly="readonly"></li>
        </ul>
        <section id="logout_button" tapmode="touch-down">
            退出登陆
        </section>
    </section>
</body>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/request.js"></script>
<script type="text/javascript" src="../../../script/window.js"></script>
<script type="text/javascript">
    function initFront() {
        var request = new Request('userinformation');
        request.userinformation(function(response, error) {
            var response = JSON.parse(response)
            var userperson = response.user;
            var name = userperson.name;
            var phone = userperson.phone;
            document.getElementById("username").value = name;
            document.getElementById('userphone').value = phone;
        });
        var logoutButton = $api.byId('logout_button')
        $api.addEvt(logoutButton, 'touchend', function() {
            var request = new Request('signout');
            request.signout(function(result, error) {
                request.clearToken();
                api.closeWin();
            });
        })


    }
    apiready = function() {
        initFront()
    }
</script>

</html>
